package indi.zhifa.recipe.bailan.framework.enums.dao.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import indi.zhifa.recipe.bailan.framework.enums.entity.po.SysTypeEntity;
import indi.zhifa.recipe.bailan.framework.enums.dao.mapper.TypeMapper;
import indi.zhifa.recipe.bailan.framework.enums.dao.service.ITypeDbService;
import indi.zhifa.recipe.bailan.framework.mysql.entity.annotations.ZfDbService;
import indi.zhifa.recipe.bailan.framework.mysql.service.impl.ZfDbServiceImpl;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 基类 服务实现类
 * </p>
 *
 * @author 织法
 * @since 2022-11-29
 */
@ZfDbService(name = "sys_type")
public class TypeDbServiceImpl extends ZfDbServiceImpl<TypeMapper, SysTypeEntity> implements ITypeDbService {

    @Override
    public boolean existByCode(String pCode) {
        LambdaQueryWrapper<SysTypeEntity> queryWrapper = Wrappers.<SysTypeEntity>lambdaQuery()
                .eq(SysTypeEntity::getCode,pCode);
        return exist(queryWrapper);
    }

    @Override
    public SysTypeEntity findByCode(String pCode) {
        LambdaQueryWrapper<SysTypeEntity> queryWrapper = Wrappers.<SysTypeEntity>lambdaQuery()
                .eq(SysTypeEntity::getCode,pCode);
        return findOne(queryWrapper);
    }

}
